class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
ans = []
def trav(data, i, length):
if i ==length:
ans.append(data.copy())
else:
for j in range(i, length):
data[i], data[j] = data[j], data[i]
trav(data, i+1, length)
data[i], data[j] = data[j], data[i]
trav(nums, 0, len(nums))
return ans
1735B - Tea with Tangerines | 1735C - Phase Shift |
1321C - Remove Adjacent | 281B - Nearest Fraction |
1043A - Elections | 1598C - Delete Two Elements |
1400C - Binary String Reconstruction | 1734D - Slime Escape |
1499A - Domino on Windowsill | 991A - If at first you don't succeed |
1196C - Robot Breakout | 373A - Collecting Beats is Fun |
965A - Paper Airplanes | 863E - Turn Off The TV |
630E - A rectangle | 1104A - Splitting into digits |
19C - Deletion of Repeats | 1550B - Maximum Cost Deletion |
1693A - Directional Increase | 735D - Taxes |
989A - A Blend of Springtime | 339C - Xenia and Weights |
608A - Saitama Destroys Hotel | 1342C - Yet Another Counting Problem |
548A - Mike and Fax | 109A - Lucky Sum of Digits |
864C - Bus | 626B - Cards |
1221A - 2048 Game | 1374D - Zero Remainder Array |